home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln1286.arc
/
BNCHMARK.ADA
/
CHAP2.ADA
< prev
next >
Wrap
Text File
|
1986-09-06
|
1KB
|
69 lines
with TEXT_IO; use TEXT_IO;
procedure CHAPTER_2 is
--
-- Selected tests from Chapter Two of the Ada LRM
-- Author: Bruce A. Bergman
-- Source available from Mark Petersen's Alpo-Net FIDO board at
-- (619) 741-3412, 300/1200/2400 8,N,1
--
c, d : character;
i, j, k : integer;
s, t : string (1..48);
begin
--
-- Here are a few strings literals.
-- The last two should be equal.
--
s := "here is a sentence " &
"split across two source lines";
s := "this is a LONG " & "string literal ";
t := "this is a " & 'L' & 'O' & 'N' & 'G' & ' ' &
"string literal ";
if s /= t then
put_line("Failed string check");
end if;
--
-- Here are some character literals.
--
c := ASCII.tilde; -- Tilde character
d := '~';
if c /= d then
put_line("Failed character check");
end if;
--
-- Integer literals.
--
i := 1_000; -- one thousand
j := 1E+3;
if i /= j then
put_line("Failed exponent check");
end if;
--
-- Based literals.
--
i := 16#0FF#; -- decimal 255, binary 11111111
j := 255; -- hex FF, binary 11111111
k := 2#11111111#; -- hex FF, decimal 255
if i /= j and j /= k then
put_line("Failed based literal check");
end if;
end CHAPTER_2;